package com.ruoyi.web.controller.wnjk.app.hospital;


import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.wnjk.domain.po.WnjkDoctor;
import com.ruoyi.system.wnjk.domain.po.WnjkDoctorEvaluation;
import com.ruoyi.system.wnjk.domain.po.WnjkHospital;
import com.ruoyi.system.wnjk.domain.po.WnjkPatientConsultation;
import com.ruoyi.system.wnjk.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

import static com.ruoyi.common.core.domain.AjaxResult.success;

@RestController
@RequestMapping("/app/doctor")
public class AppInquiryDoctorController {
    @Autowired
    private IWnjkDoctorService wnjkDoctorService;
    @Autowired
    private IWnjkHospitalService wnjkHospital;
    @Autowired
    private IWnjkPatientConsultationService wnjkPatientConsultationService;
    @Autowired
    private IWnjkDoctorEvaluationService wnjkDoctorEvaluationService;


    @GetMapping("/getDoctor")
    public AjaxResult getDoctor(WnjkDoctor doctor) {
        List<WnjkDoctor> list = wnjkDoctorService.selectWnjkDoctorList(doctor);
        return success(list);
    }

    //按id查询
    @GetMapping("/getDoctorById")
    public AjaxResult getDoctorById(Long id) {
        WnjkDoctor doctor = wnjkDoctorService.selectWnjkDoctorById(id);
        return success(doctor);
    }

    @GetMapping("/getHospitalById")
    public AjaxResult getHospitalById(Long id) {
        WnjkHospital hospital = wnjkHospital.selectWnjkHospitalById(id);
        return success(hospital);
    }

    //根据医生id查询患者咨询
    @GetMapping("/getPatientConsultation")
    public AjaxResult getPatientConsultation(Long doctorId) {
        WnjkPatientConsultation wnjkPatientConsultation = wnjkPatientConsultationService.selectWnjkPatientConsultationdoctorId(doctorId);

        return success(wnjkPatientConsultation);
    }

    // 根据医生id查询医生评价
    @GetMapping("/getDoctorEvaluation")
    public AjaxResult getDoctorEvaluation(Long doctorId) {
        WnjkDoctorEvaluation wnjkDoctorEvaluation = wnjkDoctorEvaluationService.selectWnjkDoctorEvaluationdoctorId(doctorId);
        return success(wnjkDoctorEvaluation);
    }


}
